<h1>Nouveau match</h1>

<div class="new_match_bloc">

<%= form_for(@match) do |f| %>
  <%= render 'shared/error_new_match', object: @match %>
  <div class="new_match_context">
    <%= f.collection_select :tournament_id, @tournament, :id, :name, class: 'form-control', include_blank: "Sélectionnez une compétition" %>
    <br>
    <%= f.select :mode, [['Normal', 'Normal'], ['Sans règle', 'Sans règle'], ['Survie', 'Survie'], ['Distance', 'Distance'], ['Têtes et volées', 'Têtes et volées']], prompt: "Choisir un mode de jeu" %>
    <br> <br>
    <br> <br>

  </div>

  <div class="new_match_team">
  <% i = 0 %>
  <%= f.fields_for :teams do |t| %>
    <div class="new_match_team_bloc">
      <div>
        <%= t.label :"Joueur" %>
        <%= t.collection_select :player_id, @selected_players, :id, :pseudo, class: 'form-control', include_blank: "Choisir un joueur" %>
      </div>
      <hr>
      <div class="new_match_team_bloc_club">
        <%= t.collection_select :club_id, Club.all.order(:name), :id, :name, class: 'form-control', include_blank: "Choisir une équipe"%>
      </div>
      <div class="new_match_team_bloc_club_star_<%=i%>">
        <% i+=1 %>
      </div>
      <br>
      <div class="new_match_team_bloc_score">
        <%= t.label :"Score de l'équipe" %>
        <%= t.number_field :score, class: 'form-control'%>
      </div>
      <div class="new_match_team_bloc_score_prol">
        <%= t.label :"Score penalties" %>
        <%= t.number_field :prol_score, class: 'form-control'%>
      </div>
    <br>
    </div>
  <% end %>
  </div>

  <%= f.check_box :prolongations, class: 'form-control' %>
  <%= f.label :"Prolongations" %>
  <br>
  <br><br>

  <%= f.submit "Valider", class: "btn btn-primary" %>
<% end %>
</div>
